package com.bcu.calculus.controller;

import com.bcu.calculus.entity.Message;
import com.bcu.calculus.entity.Remark;
import com.bcu.calculus.entity.Review;
import com.bcu.calculus.service.RemarkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;

@Api(tags = "16 备注模块")
@RestController
@RequestMapping("/api/remark")
public class RemarkController {

    @Resource
    private RemarkService remarkService;

    @ApiOperation(value = "添加备注")
    @PostMapping(value = "/add")
    public Message<?> addRemark(Remark remark){
        return remarkService.add(remark);
    }

    @ApiOperation(value = "删除备注")
    @DeleteMapping(value = "/del")
    public Message<?> delReview(String remarkId){
        return remarkService.del(remarkId);
    }

    @ApiOperation(value = "修改备注")
    @PutMapping(value = "/update")
    public Message<?> updateReview(Remark remark){
        return remarkService.update(remark);
    }

    @ApiOperation(value = "查找备注")
    @GetMapping(value = "/getAll")
    public Message<List<Remark>> findAll(){
        return remarkService.selectAll();
    }

    @ApiOperation(value = "通过主键查找备注")
    @GetMapping(value = "/getByPK")
    public Message<Remark> findByPK(String remarkId){
        return remarkService.selectByPK(remarkId);
    }

    @ApiOperation(value = "通过sendId查找备注")
    @GetMapping(value = "/getBySendId")
    public Message<Remark> findBySendId(String sendId){
        return remarkService.selectBySendId(sendId);
    }

}
